Declaration of output variables in ST

Syntax
VAR_OUTPUT (* optional_begin *) RETAIN NON_RETAIN (* optional_end *)
  name_1, name_2, ..., name_n  : data-type := initial-value;
  name_3, name_4, ..., name_n  : STRING[length] := 'initial-value';
  name_5, name_6, ..., name_n  : ARRAY [x..y] OF data-type := [initial-value_1, initial-value_2, .., initial-value_n];
  name_7, name_8, ..., name_n  : ARRAY [x1..y1, x2..y2, x3..y3] OF data-type;  (* Here, initial values are possible as well. *)  
  name_9, name_10, ..., name_n : REF_TO type := REF(name_A);
 
(* Additional pieces of data, such as partial addresses, are also possible for the variables. *)
(* Note: If a function block type is used as type for the variable, it is actually a function block instance. *)
END_VAR
Meaning

Declaration of one or more →output variables, name_1, name_2 etc. must be →IEC-identifiers.
The declaration of more sections of this kind is allowed. The declaration is possible within declaration of a →program, of a →function block, of a →function or of a →method.

Providing the optional keyword RETAIN or NON_RETAIN  makes all elements of this section →retentive or non-retentiveRETAIN or NON_RETAIN is possible within the declaration of a program and the declaration of a function block. If variables are declared based on a structured data type within the section with RETAIN or NON_RETAIN, its structure elements (incl. nestings) are treated as retentive or non-retentive alike.

 A →data type is possible as type for a variable.

See "Supported data types" to learn which data types are supported for the declaration of variables. Use the optional →initial value [:= initial-value] to assign a value to the variable (see "Initialization of variables in ST" for details).
Moreover, it is possible to declare:

 The declaration of output ENO is not necessary. See "Execution control: EN, ENO" for information on output ENO

Good to know

(grey lightbulb)  Moreover, Neuron Power Engineer allows you to define a not yet fully specified location for the declaration. See "Declaration of a language element with partial address in ST" for details.

(grey lightbulb)  Moreover, Neuron Power Engineer allows you to specify additional data for the declaration. See "Defining description, comment, JSON string or type for variables or data types" for details.

(grey lightbulb) Within a section VAR_OUTPUT...END_VAR, it is also possible to declare function block instances and to declare variables based on an interface.

Example
VAR_OUTPUT
  OUT : BOOL;
  ET_OFF: TIME; 
  O1: ARRAY [1..2] of BOOL;
  O2 : STRING[10]; 
  myRefO: REF_TO INT;
END_VAR